package com.info.zhiduoduo.repository.mapper.crowdsource;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.entity.crowdsource.CrowdsourceImportRecord;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * @author tianyonghong
 * @create 2023/7/20
 */
public interface CrowdsourceImportRecordMapper extends BaseMapper<CrowdsourceImportRecord> {

    @Select("select cir.*,c.compname from zdd_crowdsource_import_record cir " +
            " left join zdd_company c on cir.compid = c.compid " +
            " where if(isnull(#{compname}), 1=1, c.compname like '%${compname}%') " +
            " and if(#{createBy} = 0, 1=1, cir.create_by = #{createBy} ) " +
            " and if(isnull(#{createStart}), 1=1, cir.create_time >= #{createStart})" +
            " and if(isnull(#{createEnd}), 1=1, cir.create_time <= #{createEnd}) " +
            " order by cir.create_time desc ")
    List<CrowdsourceImportRecord> getList(String compname, int createBy, Date createStart, Date createEnd);
}
